<div class="fbusiness">
    <div class="wrap">
        <div class="list">
            <ul>
                <li>
                    <div class="ftlte wow fadeInUp"data-wow-delay="0.2s" data-wow-duration="1s">
                        <h2><i>Change Pwd</i></h2>
                    </div>
                </li>
            </ul>
        </div>
    </div>
    <div class="addcar wrap" style="width: 100%">
        <div class="rt" style="width: 90%">
            <div class="bora" style="box-shadow:0 0 0 0">
                <ul class="clearfix" >
                    <li>
                        <h2 style="float: left">Current Password</h2>
                        <input class="txt" type="password" name="current_password"
                               lay-verify="required_en" maxlength="60"
                               lay-verType="tips"  class="layui-input"/>
                    </li>
                    <li>
                        <h2 style="float: left">New Password</h2>
                        <input class="txt" type="password" name="new_password" id="new_password"
                               lay-verify="required_en|pwd_en" maxlength="60"
                               lay-verType="tips"  class="layui-input"/>
                    </li>
                    <li>
                        <h2 style="float: left">Confirm Password</h2>
                        <input class="txt" type="password" name="confirm_password" id="confirm_password"
                               lay-verify="required_en|pwd_en" maxlength="60"
                               lay-verType="tips"  class="layui-input"/>
                    </li>
                </ul>
                <div class="ac_ts" style="font-size: 18px;">
                    Your password should:<br>
                    ○ contains upper and lower case letters<br>
                    ○ have at least one numbers<br>
                    ○ have at least one special characters<br>
                    ○ at least 12 bits in length and less than 32 bits
                </div>
                <button type="button" class="btna" lay-submit lay-filter="sub">Confirm</button>
            </div>
        </div>
    </div>
</div>
<script>
    layui.use(['form'], function () {
        var form = layui.form;

        form.on('submit(sub)', function(data){
            $new_password       = $('#new_password').val();
            $confirm_password   = $('#confirm_password').val();
            if($new_password != $confirm_password){
                layer.msg('The two passwords don\'t match.' , {time:2000 , icon:2});
                return false;
            }
            JsPost("{:url('user/changePwd')}", data.field, function(res){
                if(res.code){
                    layer.msg(res.msg, {time:1500 , icon:1},function(){
                        window.location.href = "{:url('home/index')}";
                    });
                }else{
                    layer.msg(res.msg , {time:1500 , icon:2});
                }
            })
        });
    });
</script>
